import request from "@/utils/request";
import { getToken, getUserId, getSiteId } from "@/utils/auth";

// 品牌查询
export function brandQueryApi(params = { keyStr: "", pageNum: 1, pageSize: 10 }) {
  return request({
    url: "/BrandQueryV3/GetBrandList",
    method: "get",
    params: {
      KeyStr: params.keyStr,
      AccessToken: getToken(),
      SiteId: getSiteId(),
      PageIndex: params.pageNum,
      PageSize: params.pageSize
    },
  });
}


// 品牌增改，BrandId=0新增，否则修改
export function brandUpdateApi(data = { BrandId: 0, BrandName: "", BrandLogo: "", SortIndex: "" }) {
  return request({
    url: "/BrandAddV3/Post",
    method: "post",
    data: {
      BrandId: data.BrandId,
      BrandName: data.BrandName,
      BrandLogo: data.BrandLogo,
      SortIndex: data.SortIndex,
      AccessToken: getToken(),
      SiteId: getSiteId(),
    },
  });
}

// 品牌删除
export function brandRemoveApi(BrandIds = []) {
  return request({
    url: "/BrandDeleteV3/Post",
    method: "post",
    data: {
      BrandIds: BrandIds.join(','),
      AccessToken: getToken(),
      SiteId: getSiteId(),
    },
  });
}